package cn.jeeweb.modules.web.labor.service.impl;

import cn.jeeweb.core.common.service.impl.CommonServiceImpl;
import cn.jeeweb.core.query.data.Page;
import cn.jeeweb.core.query.data.PageImpl;
import cn.jeeweb.core.query.data.Pageable;
import cn.jeeweb.core.query.data.Queryable;
import cn.jeeweb.core.query.parse.QueryToWrapper;
import cn.jeeweb.modules.web.labor.content.HuSubjectContent;
import cn.jeeweb.modules.web.labor.mapper.HuSubjectCategoryMapper;
import cn.jeeweb.modules.web.labor.entity.HuSubjectCategory;
import cn.jeeweb.modules.web.labor.service.IHuSubjectCategoryService;
import com.baomidou.mybatisplus.mapper.Wrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;

/**   
 * @Title: hu_subject_category
 * @Description: hu_subject_category
 * @author rql
 * @date 2018-02-03 16:42:57
 * @version V1.0   
 *
 */
@Transactional
@Service("huSubjectCategoryService")
public class HuSubjectCategoryServiceImpl  extends CommonServiceImpl<HuSubjectCategoryMapper,HuSubjectCategory> implements  IHuSubjectCategoryService {


    @Resource
    private HuSubjectCategoryMapper huSubjectCategoryMapper;


    public Page<HuSubjectContent> selectSubjectList(Queryable queryable,Wrapper<HuSubjectContent> wrapper){
        QueryToWrapper<HuSubjectContent> queryToWrapper = new QueryToWrapper<HuSubjectContent>();
        queryToWrapper.parseCondition(wrapper, queryable);
        // 排序问题
        queryToWrapper.parseSort(wrapper, queryable);
        Pageable pageable = queryable.getPageable();
        com.baomidou.mybatisplus.plugins.Page<HuSubjectContent> content = new com.baomidou.mybatisplus.plugins.Page<HuSubjectContent>(
                pageable.getPageNumber(), pageable.getPageSize());
        List<HuSubjectContent> list=huSubjectCategoryMapper.selectSubjectList(content);
        content.setRecords(list);
        return new PageImpl<HuSubjectContent>(content.getRecords(), queryable.getPageable(), content.getTotal());
    }


    public List<HuSubjectCategory> selectTranList(String id){

      return   huSubjectCategoryMapper.selectTranList(id);
    }
}
